package com.yuyue.springFramework.note10.entity;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.support.StaticMessageSource;

import java.util.Locale;

/**
 * 实现了spring的InitializingBean接口，重写属性填充后方法 afterPropertiesSet，此方法会在Bean初始化前调用
 */
public class MessageSourceFromDb extends StaticMessageSource implements InitializingBean {
    @Override
    public void afterPropertiesSet(){
        this.addMessage("desc", Locale.CHINA, "从数据库中获取信息");
        this.addMessage("desc", Locale.UK, "MessageSource from DataBase");
    }
}
